import notice from "./components/model-弹出层-vue/modal.js";
export default {
  name: "Home",
  template: `
  <div>
    <br/>
    <el-button type='primary' style='margin-left: 10px' icon='el-icon-mouse' @click='open' round>按下按钮弹出提示框</el-button>
    <el-button type='primary' style='margin-left: 10px' icon='el-icon-mouse' @click='showSpeech' round>语音框</el-button></el-button>
  </div>
  `,
  setup() {
    function open() {
      notice({
        title: "简陋的提示框",
        message: "这是一个自己封装的提示框,基于vue3",
        duration: 100,
        to: "/index.html",
      });
    }
    function showSpeech() {
      var a = document.createElement("a");
      // a.setAttribute("href", "./test.html");
      a.setAttribute(
        "href",
        "./components/mobile_universal_components/speech_box.html"
      );
      a.setAttribute("target", "_blank");
      a.setAttribute("id", "js_a");
      //防止反复添加
      if (document.getElementById("js_a")) {
        document.body.removeChild(document.getElementById("js_a"));
      }
      document.body.appendChild(a);
      a.click();
    }
    return {
      open,
      showSpeech,
    };
  },
};
